﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 单例模式
{
    class Singleton
    {
        private static Singleton _s;
        private Singleton() { }
        public Singleton GetInstance()
        {
            lock (_s)
            {
                return _s ?? (_s = new Singleton());
            }
        }
    }
}
